package com.zf.shuashua.bean.advert;

import android.util.Log;

import java.io.Serializable;
import java.util.List;

/**
 * 横屏信息流广告配置
 */
public class HorizontalConfigBean implements Serializable {

    //信息流
    private List<AdvertConfigBean> horizontal;
    private int indexDraw = -1;
    //评论列表横屏信息流
    private int indexComment = -1;

    /**
     * 顺序执行横屏信息流配置
     * @return
     */
    public AdvertConfigBean getHorizontalConfig(){
        if(horizontal == null || horizontal.size() < 1){
            return null;
        }
        if(horizontal.size() == 1){
            return horizontal.get(0);
        }
        int index = indexDraw + 1 < horizontal.size() ? indexDraw + 1 : 0;
        indexDraw = index;
        return horizontal.get(index);
    }

    /**
     * 顺序执行横屏信息流配置-评论列表
     * @return
     */
    public AdvertConfigBean getCommonHorizontalConfig(){
        if(horizontal == null || horizontal.size() < 1){
            return null;
        }
        if(horizontal.size() == 1){
            return horizontal.get(0);
        }
        int index = indexComment + 1 < horizontal.size() ? indexComment + 1 : 0;
        indexComment = index;
        return horizontal.get(index);
    }


    public List<AdvertConfigBean> getHorizontal() {
        return horizontal;
    }

    public void setHorizontal(List<AdvertConfigBean> horizontal) {
        this.horizontal = horizontal;
    }
}
